package cn.usian.controller;

import cn.usian.pojo.User;
import cn.usian.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.annotation.Resource;
import java.util.List;

public class UserController {
    @Resource
    private UserService userService;


    @GetMapping
    public List<User> findAll(){
        List<User> list= userService.findAll();
        return list;
    }
    @PostMapping("/add")
    public void  add(@RequestBody User user){
        userService.add(user);
    }
}
